package org.abc.fund.controller.funds;

import org.abc.fund.entity.funds.FundTag;
import org.abc.fund.service.funds.FundTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/tag")
public class FundTagController {

    @Autowired
    private FundTagService tagService;

    @GetMapping("/all")
    public List<FundTag> getAllTags(@RequestParam(required = false) String category) {
        return tagService.getAllTags(category);
    }

    @PostMapping("/add")
    public ResponseEntity<?> addTag(@RequestBody FundTag tag) {
        return tagService.addTag(tag);
    }

    @DeleteMapping("/delete/{id}")
    public ResponseEntity<?> deleteTag(@PathVariable Long id) {
        return tagService.deleteTag(id);
    }
}
